<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>课程定单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" >
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
   </head>
<body>
<form class="layui-form" action="" id="form">
    <input type="hidden" name="order_id" th:value="${order.order_id}">
    <div style="height: 20px"></div>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="name"  lay-verify="title" th:value="${order.name}" class="layui-input">
        </div>
        <label class="layui-form-label">WeChat号</label>
        <div class="layui-input-inline">
            <input type="text" name="wechat_no" th:value="${order.wechat_no}"  autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">WeChat备注</label>
        <div class="layui-input-inline">
            <input type="text" name="wechat_mark"  th:value="${order.wechat_mark}"   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">QQ号</label>
        <div class="layui-input-inline">
            <input type="text" name="qq_no"   th:value="${order.qq_no}" class="layui-input">
        </div>
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input type="text" name="tel"  th:value="${order.tel}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">购买课程</label>
        <div class="layui-input-inline">
            <input type="text" name="course_name" th:value="${order.course_name}"   class="layui-input">
        </div>
        <label class="layui-form-label">购买价格</label>
        <div class="layui-input-inline">
            <input type="text" name="course_price"  th:value="${order.course_price}" class="layui-input">
        </div>

        <label class="layui-form-label">购买日期</label>
        <div class="layui-input-inline">
            <input type="text" name="order_date" id="date"  th:value="${order.order_date}"   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div  class="layui-input-block" style="width: 600px">
            <textarea name="remark" placeholder="备注" class="layui-textarea"  th:text="${order.remark}"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" layui-btn type="button" onclick="updateAction();">更新</button>
        </div>
    </div>
</form>

<script th:inline="none">

    var form,layer,layedit,laydate,$;
    layui.use(['form', 'layedit', 'laydate'], function() {
        form = layui.form;
        layer = layui.layer;
        layedit = layui.layedit;
        laydate = layui.laydate;
        $ = layui.jquery;

        //日期
        laydate.render({
            elem: '#date'
        });
    });

    function updateAction() {
        var formData = $("#form").serialize();
        $.post("/courseorder/save",formData,function(message){
            if(message.success == 1){
                layer.alert("update成功",{yes:function () {
                    parent.layer.closeAll();
                }});
            }else{
                layer.alert("update失败",{yes:function () {
                    parent.layer.closeAll();
                }});
            }
        });
    }

</script>
</body>
</html>
